const koa=require("koa");
const bodyParser=require("koa-bodyparser");
const cors=require("koa-cors");
const path=require("path");
const registerRouter=require("./routes/index");
const static=require("koa-static");
require("./controller/sql");
const app=new koa()

//配置静态资源
// const staticPath=require("./static");
// app.use(static(
//   path.join(__dirname,staticPath)
// ))
app.use(cors()); //处理跨域
app.use(bodyParser()) //解析上下文
app.use(registerRouter())
app.listen(3001, () => {
  console.log('App listening on port 3001!');
});